
import java.awt.CardLayout;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Ave
 */
public class mainFrame extends javax.swing.JFrame {
    private panel1 satu = new panel1();
    private panel2 dua = new panel2();
    private panelAbout about = new panelAbout();
    /**
     * Creates new form mainFrame
     */
    public mainFrame() {
        initComponents();
        setTitle("Tutorial Card Layout");
        setExtendedState(MAXIMIZED_BOTH);
        panelForm.add(satu , "panel1");
        panelForm.add(dua, "panel2");
        panelForm.add(about, "tentang");


    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        panelForm = new javax.swing.JPanel();
        utama = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        menuBar = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        MenuPanel1 = new javax.swing.JMenuItem();
        MenuPanel2 = new javax.swing.JMenuItem();
        MenuUtama = new javax.swing.JMenuItem();
        MenuAbout = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        panelForm.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        panelForm.setLayout(new java.awt.CardLayout());

        utama.setLayout(new java.awt.BorderLayout());

        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setText("MASTER");
        utama.add(jLabel1, java.awt.BorderLayout.CENTER);

        panelForm.add(utama, "utama");

        getContentPane().add(panelForm, java.awt.BorderLayout.CENTER);

        jMenu1.setText("File");

        MenuPanel1.setText("Panel 1");
        MenuPanel1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                MenuPanel1MouseClicked(evt);
            }
        });
        MenuPanel1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenuPanel1ActionPerformed(evt);
            }
        });
        jMenu1.add(MenuPanel1);

        MenuPanel2.setText("Panel2");
        MenuPanel2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenuPanel2ActionPerformed(evt);
            }
        });
        jMenu1.add(MenuPanel2);

        MenuUtama.setText("MenuUtama");
        MenuUtama.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenuUtamaActionPerformed(evt);
            }
        });
        jMenu1.add(MenuUtama);

        MenuAbout.setText("About");
        MenuAbout.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenuAboutActionPerformed(evt);
            }
        });
        jMenu1.add(MenuAbout);

        menuBar.add(jMenu1);

        setJMenuBar(menuBar);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void MenuPanel1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_MenuPanel1MouseClicked
        // TODO add your handling code here:
        CardLayout cl = (CardLayout)panelForm.getLayout();
        cl.show(panelForm, "panel1");


    }//GEN-LAST:event_MenuPanel1MouseClicked

    private void MenuPanel1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuPanel1ActionPerformed
        // TODO add your handling code here:
        CardLayout cl = (CardLayout)panelForm.getLayout();
        cl.show(panelForm, "panel1");
    }//GEN-LAST:event_MenuPanel1ActionPerformed

    private void MenuPanel2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuPanel2ActionPerformed
        // TODO add your handling code here:
        CardLayout cl = (CardLayout)panelForm.getLayout();
        cl.show(panelForm, "panel2");
    }//GEN-LAST:event_MenuPanel2ActionPerformed

    private void MenuUtamaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuUtamaActionPerformed
        // TODO add your handling code here:
        CardLayout cl = (CardLayout)panelForm.getLayout();
        cl.show(panelForm, "utama");
    }//GEN-LAST:event_MenuUtamaActionPerformed

    private void MenuAboutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuAboutActionPerformed
        // TODO add your handling code here:
        CardLayout cl = (CardLayout)panelForm.getLayout();
        cl.show(panelForm, "tentang");
    }//GEN-LAST:event_MenuAboutActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(mainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(mainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(mainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(mainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new mainFrame().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuItem MenuAbout;
    private javax.swing.JMenuItem MenuPanel1;
    private javax.swing.JMenuItem MenuPanel2;
    private javax.swing.JMenuItem MenuUtama;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JPanel panelForm;
    private javax.swing.JPanel utama;
    // End of variables declaration//GEN-END:variables
}
